package cn.linjianhui.flink.sample.model;

import org.apache.commons.compress.utils.Sets;

import java.math.BigDecimal;
import java.util.Set;

public class SaleChannelAccumulator {

    private String saleChannel;
    private BigDecimal payAmount;
    private Set<String> orderIds;

    public SaleChannelAccumulator() {
        saleChannel = "";
        payAmount = BigDecimal.ZERO;
        orderIds = Sets.newHashSet();
    }

    public void setSaleChannel(String saleChannel) {
        this.saleChannel = saleChannel;
    }

    public String getSaleChannel() {
        return this.saleChannel;
    }

    public void setPayAmount(BigDecimal payAmount) {
        this.payAmount = payAmount;
    }

    public BigDecimal getPayAmount() {
        return this.payAmount;
    }

    public void setOrderIds(Set<String> orderIds) {
        this.orderIds = orderIds;
    }

    public Set<String> getOrderIds() {
        return orderIds;
    }

    public boolean addOrderId(String orderId) {
        return this.orderIds.add(orderId);
    }

    public boolean containsOrder(String orderId) {
        return this.orderIds.contains(orderId);
    }

    public void addPayAmount(BigDecimal amount) {
        this.payAmount = this.payAmount.add(amount);
    }

    public boolean addOrderIds(Set<String> orderIds) {
        return this.orderIds.addAll(orderIds);
    }

}
